package com.ruoyi.system.service.impl;

import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.system.domain.TbSearchHistory;
import com.ruoyi.system.mapper.TbSearchHistoryMapper;
import com.ruoyi.system.service.ITbSearchHistoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 搜索记录Service业务层处理
 * 
 * @author ruoyi
 * @date 2024-04-07
 */
@Service
public class TbSearchHistoryServiceImpl implements ITbSearchHistoryService 
{
    @Autowired
    private TbSearchHistoryMapper tbSearchHistoryMapper;

    /**
     * 查询搜索记录
     * 
     * @param id 搜索记录主键
     * @return 搜索记录
     */
    @Override
    public TbSearchHistory selectTbSearchHistoryById(Long id)
    {
        return tbSearchHistoryMapper.selectTbSearchHistoryById(id);
    }

    /**
     * 查询搜索记录列表
     * 
     * @param tbSearchHistory 搜索记录
     * @return 搜索记录
     */
    @Override
    public List<TbSearchHistory> selectTbSearchHistoryList(TbSearchHistory tbSearchHistory)
    {
        return tbSearchHistoryMapper.selectTbSearchHistoryList(tbSearchHistory);
    }

    /**
     * 新增搜索记录
     * 
     * @param tbSearchHistory 搜索记录
     * @return 结果
     */
    @Override
    public int insertTbSearchHistory(TbSearchHistory tbSearchHistory)
    {
        tbSearchHistory.setCreateTime(DateUtils.getNowDate());
        return tbSearchHistoryMapper.insertTbSearchHistory(tbSearchHistory);
    }

    /**
     * 修改搜索记录
     * 
     * @param tbSearchHistory 搜索记录
     * @return 结果
     */
    @Override
    public int updateTbSearchHistory(TbSearchHistory tbSearchHistory)
    {
        tbSearchHistory.setUpdateTime(DateUtils.getNowDate());
        return tbSearchHistoryMapper.updateTbSearchHistory(tbSearchHistory);
    }

    /**
     * 批量删除搜索记录
     * 
     * @param ids 需要删除的搜索记录主键
     * @return 结果
     */
    @Override
    public int deleteTbSearchHistoryByIds(Long[] ids)
    {
        return tbSearchHistoryMapper.deleteTbSearchHistoryByIds(ids);
    }

    /**
     * 删除搜索记录信息
     * 
     * @param id 搜索记录主键
     * @return 结果
     */
    @Override
    public int deleteTbSearchHistoryById(Long id)
    {
        return tbSearchHistoryMapper.deleteTbSearchHistoryById(id);
    }
}
